//
//  System.h
//  Rippton2.0
//
//  Created by 胡旭辉 on 2019/7/3.
//  Copyright © 2019 胡旭辉. All rights reserved.
//

#ifndef System_h
#define System_h

/// 开发环境
//#define HtmlUrl    @"http://neice.showyork.com/h5/"
//#define BaseUrl @"http://121.196.8.248:8000/"
///// 测试环境
#define HtmlUrl    @"http://114.215.188.237/h5/"
#define BaseUrl @"http://114.215.188.237:8000/"
/// 正式环境
//#define HtmlUrl    @"https://ohbd.showyork.com/h5/"
//#define BaseUrl @"https://ddupapi.showyork.com/"
/// 小何本地
//#define HtmlUrl    @"http://neice.showyork.com/h5/"
//#define BaseUrl @"http://192.168.31.111:8000/"
/// 小刘本地
//#define HtmlUrl    @"http://neice.showyork.com/h5/"
//#define BaseUrl @"http://172.16.1.190:8000/"

#define kGET_REQUEST_URL(api) [RPNetworkTool getRequestURLWithAPI:api]

#define ShowErrorState(state) [SVProgressHUD showErrorWithStatus:state];

#define ShowNormalState(state) [SVProgressHUD showWithStatus:state];

#define ShowSuccessState(state) [SVProgressHUD showSuccessWithStatus:state];

#define IPHONE_X \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

#ifdef DEBUG
#define NSLog(FORMAT, ...) NSLog(@"%@:%d %s %@\n",[[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, __FUNCTION__, [NSString stringWithFormat:FORMAT, ##__VA_ARGS__])
#else
#define NSLog(...)
#endif

/*-----------------适配*/
#define GK_SAVEAREA_TOP                 (IPHONE_X ? 24.0f : 0.0f)   // 顶部安全区域
#define GK_SAVEAREA_BTM                 (IPHONE_X ? 34.0f : 0.0f)   // 底部安全区域
#define GK_STATUSBAR_HEIGHT             (IPHONE_X ? 44.0f : 20.0f)  // 状态栏高度
#define kNavBarHeight                   (IPHONE_X ? 88.0f : 64.0f)
#define kNavStatusBarHeight             (IPHONE_X ? 44.0f : 20.0f)
#define kTabBarHeight                   (IPHONE_X ? 83.0f : 49.0f)
#define kTabDefaultHeight                     49.0f
#define kItemHeight                     44.0f // 默认高度

/*-------------------------系统配置方法*/
#define RGBOF(rgbValue)    [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBA(R,G,B,A)     [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]

#define C(RGB,A)  [UIColor colorWithRed:RGB/255.0f green:RGB/255.0f blue:RGB/255.0f alpha:A]

#define C35  RGBA(35,24,21,1)
#define C153 RGBA(153,153,153,1)
#define C102 RGBA(102,102,102,1)
#define C21  RGBA(21,24,35,1)
#define C51  RGBA(51,51,51,1)
#define font(f)  [UIFont systemFontOfSize:f]
// 屏幕的宽度
#define kScreenW [UIScreen mainScreen].bounds.size.width
// 屏幕的高度
#define kScreenH [UIScreen mainScreen].bounds.size.height

#define KScaleWidth(width) ((width)*(kScreenW/375.f))
#define KScaleHeight(height) ((height)*(kScreenH/812.0f))\


/// 弱引用对象
#define SL_WeakSelf __weak typeof(self) weakSelf = self;

///主线程操作
#define SL_DISPATCH_ON_MAIN_THREAD(mainQueueBlock) dispatch_async(dispatch_get_main_queue(),mainQueueBlock);
#define SL_GCDWithGlobal(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define sl_GCDWithMain(block) dispatch_async(dispatch_get_main_queue(),block)

///NSUserDefaults 存储
#define SL_UserDefaultSetObjectForKey(__VALUE__,__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] setObject:__VALUE__ forKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}
///NSUserDefaults     获得存储的对象
#define SL_UserDefaultObjectForKey(__KEY__)  [[NSUserDefaults standardUserDefaults] objectForKey:__KEY__]
///NSUserDefaults      删除对象
#define SL_UserDefaultRemoveObjectForKey(__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}

#define RESPONSE @"response"
#define LIST @"list"
#define LASTPAGE @"isLastPage"
#define NEXTPAGE @"hasNextPage"
#define TOTAL @"total"

/// 通知
#define NEXTQUESTIONPAGE @"nextQuestionPage"

#define RPCachesPath NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject
#define RPArchiverPath [RPCachesPath stringByAppendingString:@"UserInfo.txt"]


#endif /* System_h */
